package com.shop.controller;


import com.shop.entity.PlatformAccountRecord;
import com.shop.model.PageParam;
import com.shop.model.vo.Rsp;
import com.shop.service.PlatformAccountService;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * gaodo的爸爸(PlatformAccount)表控制层
 *
 * @author makejava
 * @since 2020-11-29 09:57:08
 */
@Validated
@RestController
@AllArgsConstructor
public class PlatformAccountController {
    /**
     * 服务对象
     */
    private final PlatformAccountService platformAccountService;

    @GetMapping("getBalance")
    public Rsp getBalance(@RequestHeader("userId") Integer userId){
        return platformAccountService.getBalance(userId);
    }

    @PostMapping("getWithdrawRecord")
    public Rsp getWithdrawRecord(@RequestHeader("userId") Integer userId, @RequestBody PageParam<PlatformAccountRecord> pageParam){
        return platformAccountService.getWithdrawRecord(userId,pageParam);
    }

    @PostMapping("getWithdrawRecordPlatform")
    public Rsp getWithdrawRecordPlatform(@RequestBody PageParam<PlatformAccountRecord> pageParam){
        return platformAccountService.getWithdrawRecordPlatform(pageParam);
    }

    @PostMapping("addWithdraw")
    public Rsp addWithdraw(@RequestHeader("userId") Integer userId,@RequestBody PlatformAccountRecord record){
        return platformAccountService.addWithdraw(userId,record);
    }

    @PostMapping("checkWithdraw")
    public Rsp checkWithdraw(@RequestBody PlatformAccountRecord record){
        return platformAccountService.checkWithdraw(record);
    }
}
